package com.help.push;

import com.help.push.android.AndroidBroadcast;

public class SendToMobile {
	private static final String appkey = "559e93fa67e58efbd7006b56";
	private static final String appMasterSecret = "sswbvijzi9zvhb2lazzrzpy7qppaceqe";
	public static String  sendAndroidBroadcast(String ticker ,String title,String text) throws Exception {
		AndroidBroadcast broadcast = new AndroidBroadcast();
		broadcast.setAppMasterSecret(appMasterSecret);
		broadcast.setPredefinedKeyValue("appkey", appkey);
		
		broadcast.setPredefinedKeyValue("timestamp",Integer.toString((int)(System.currentTimeMillis() / 1000)));
		broadcast.setPredefinedKeyValue("ticker", ticker);
		broadcast.setPredefinedKeyValue("title",  title);
		broadcast.setPredefinedKeyValue("text",   text);
		broadcast.setPredefinedKeyValue("after_open", "go_app");
		broadcast.setPredefinedKeyValue("display_type", "notification");
		// TODO Set 'production_mode' to 'false' if it's a test device. 
		// For how to register a test device, please see the developer doc.
		broadcast.setPredefinedKeyValue("production_mode", "true");
		// Set customized fields
		broadcast.setExtraField("test", "helloworld");
		return broadcast.send();
	}
	public static void main(String args[] ){
		try {
			String str=SendToMobile.sendAndroidBroadcast("我","我","我");
			System.out.println(str);
		} catch (Exception e) {
			
			e.printStackTrace();
		}
	}
}
